package com.hzy.pay.alipay.util;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 阿里支付配置
 * 
 * @author zhuowei.luo
 * @date 2018/7/9
 */
@Component
public class AlipayConfigUtil {
    /**
     * 阿里调用网关地址 
     */
	public static String serverUrl = "https://openapi.alipay.com/gateway.do";
    /**
     * 阿里授权地址 
     */
	public static String oauthUrl = "https://openauth.alipay.com/oauth2/publicAppAuthorize.htm";
    /**
     * appId 
     */
	public static String appId; 
    /**
     * rsa私有key，注意：这里是pkcs8编码的私有key！！！ 
     */
	public static String privateKeyForPkcs8;
    /**
     * rsa公共key，注意：不是应用公共key，是阿里的公共key！！！这里是个坑 
     */
	public static String publicKeyForAlipay;
    /**
     * rsa公共key，注意：不是应用公共key，是阿里的公共key！！！这里是个坑 
     */
    public static String notifyUrl;
    /**
     * 格式：json 
     */
	public static String format = "json";
    /**
     * 编码：UTF-8 
     */
	public static String charset = "UTF-8";
    /**
     * 非对称加密类型：RSA2 
     */
	public static String signType = "RSA2";

    @Value("{pay.alipay.appId}")
    public static void setAppId(String appId) {
        AlipayConfigUtil.appId = appId;
    }

    @Value("{pay.alipay.privateKey}")
    public static void setPrivateKeyForPkcs8(String privateKey) {
        AlipayConfigUtil.privateKeyForPkcs8 = privateKey;
    }

    @Value("{pay.alipay.publicKey}")
    public static void setPublicKeyForAlipay(String publicKey) {
        AlipayConfigUtil.publicKeyForAlipay = publicKey;
    }

    @Value("{pay.alipay.notifyUrl}")
    public static void setNotifyUrl(String notifyUrl) {
        AlipayConfigUtil.notifyUrl = notifyUrl;
    }
}
